#!/bin/bash
# Este script coleta os dados referentes ao total de horas consumidas na simulacao, bem como a quantidade de recursos reservados em cada cenario

set_classpath() {
        LIB_DIR="lib"
        CLASSPATH=""
        for lib in $LIB_DIR/*; do
                CLASSPATH="$CLASSPATH:$lib"
        done
}

set_classpath
#CLASSPATH="./saasim-0.0.2-SNAPSHOT.jar"

#Consumptions
for heur in on iosup rf super ut ; do

		rm ${heur}/consumption.dat
		for index in `seq 1 70`; do
			tail -n 12 ${heur}/data_${index}.output >> ${heur}/consumption.dat #Consumo de todas as cargas!
		done

done

#Plans
for heur in on iosup rf super ut ; do

		rm ${heur}/plans.dat
		for index in `seq 1 70`; do
			a=`java -cp ${CLASSPATH} commons.util.ParsePlan ${heur}/model_${index}.plan | tail -n 1`
			echo ${a} >> ${heur}/plans.dat
		done

done
